-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add delete user fuctionality, increase verbosity and general refactoring #2
Conversation
Co-authored-by: Björn Grüning <[email protected]>
Co-authored-by: Björn Grüning <[email protected]>
Co-authored-by: Björn Grüning <[email protected]>
Should we also log when we delete users, or does it disturb the logs too much (e.g. when you want to use telegraf) |
shall I split it up in multiple PRs so we can merge the fix for symlinks and increased verbosity now? |
I think this is finally ready for review :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It reads fine at first glance. Has this been tested? Would it be possible to add some mock tests?
Yes, I tested on my instance and I can give you access, so you can try yourself if you want. |
Oh, cool then. Yup, test coverage would be excellent! Thank you! |
But it might be inefficient, because I never wrote cli tests for python before and the last unit test is 5 y ago. also if we merge #7 we might need to rewrite/change it again. |
Feel free to merge or wait for @bgruening's review. |
Go for it! Fingers crossed! |
Merging will not change our production servers – versions are fixed |
Important info:
delete
a user means:The user will notified using the notification framwork and an "urgent" notification, which should be delivered by email and can not be unsubscribed. The user will be marked as deleted in the database, all running jobs will be cancelled, all sessions will be terminated and login is blocked.
However it will NOT delete all their data, histories etc. on the spot.
This only happens when a user is
purged
Delete user functionality works as follows:
The user can specify the flag
--delete-user <MIN_SEVERITY>
, where<MIN_SEVERITY>
must be one of the definedVALID_SEVERITIES
(low, medium and high), this is not case sensitive.Everytime the script matches a file in a jwd to the malware database,
and if the severity level of that malware is EQUAL OR HIGHER than the specified
<MIN_SEVERITY>
, the Galaxy user ID is added to a set nameddelete_users
.Once the iteration over the running jobs found in the databse is done, the script iterates over the
delete_users
set, requests an encoded version of their user ID from Galaxy's API (GALAXY_BASE_URL
andGALAXY_API_KEY
must be set in the~/.bashrc
file of the user running WALL·E) and then creates a notification that will stay in the database for 6 months and sends aDELETE
request to/api/users/<encoded_id>
.The second, more minor change in this PR is the amount of information that is logged in verbosity mode: